﻿using ZMQ;
using System.Text;
using System.Configuration;

namespace AuctionServer
{
    internal sealed class Notifier
    {
        private readonly Socket publisher;
        private readonly string publisherEndpoint;
        public static readonly Notifier Instance = new Notifier();
        private Notifier()
        {
            publisherEndpoint = ConfigurationManager.AppSettings["publisherEndpoint"] ?? "tcp://127.0.0.1:5000";
            publisher = new Context(1).Socket(SocketType.PUB);
        }
        public void Bind()
        {
            publisher.Bind(publisherEndpoint);
        }
        public void Notify(string message)
        {
            publisher.Send(message, Encoding.UTF8);
        }
    }
}